﻿using System.Collections.Generic;

namespace ConsoleApp
{
        public interface IElement
        {
                IDictionary<string, object> Builder { get; }
                void Attr(string name, string value);
                string GetAttr(string name);
        }

        public class Element : IElement
        {
                protected readonly IDictionary<string, object> builder;

                public Element()
                {
                        builder = new Dictionary<string, object>();
                }

                public void Attr(string name, string value)
                {
                        builder.Add(name, value);
                }

                IDictionary<string, object> IElement.Builder
                {
                        get { return this.builder; }
                }

                string IElement.GetAttr(string name)
                {
                        return builder.ContainsKey(name) ? builder[name].ToString() : null;
                }
        }
}
